﻿// ConsoleApplication1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include <string>
using namespace std;
int main()
{
    //内存状态调试
  /*  char a = 'c';
    char b[10] = "abcdef";
    wchar_t c[10] = L"abcdef";
    int d = 10;
    float e = 10.1f;
    double f = 10.1;
    bool g = true;*/
    
    //位运算
   /*
    int a = 10; // 0000 1010
    int b = 20; // 0001 0100
    cout << (a & b) << endl;
    cout << (a | b) << endl;
    cout << (a ^ b) << endl;
    cout << ~a << endl;    //1111 0101
    cout << (a >> 2) << endl;
    */

    //C风格指针指向字符
  /*  char a = 'a';
    char* p = &a;
    cout << *p << endl;*/

    //C风格指针指向字符串
    /*char b[10] = "abcde";
    //begin() end()
    char* p = b;
    char* p = &b[2];
    cout << *p << endl;*/

    //string 操作
    /*string a = "helloworld";
    cout << a.size() << endl;
    string s1, s2;
    cin >> s1 >> s2;
    cout << s1 << s2;
    string s;
    getline(cin, s);
    cout << s;*/

    //string 遍历  索引方式、
    string s = "helloworld";
    string* ps = &s;
    /*for (int index = 0; index < s.size(); ++index) {
        cout << s[index] << endl;
    }*/

    /*string::iterator it_s;
    for (it_s = s.begin(); it_s != s.end(); ++it_s) {
        cout << *it_s << endl;
     }*/

    for (auto& w : s) {
        //cout << w << endl;
        //++w;
        w = 'x';
    }
    cout << s << endl;
}

